/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ViewTimeSchedule.java
 *
 * Created on Jul 28, 2011, 3:36:31 PM
 */
package employee;

import generalCode.Connectionsql;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Vector;

/**
 *
 * @author RainnjeLee
 */
public class ViewTimeSchedule extends javax.swing.JFrame {

     private ArrayList<String> ViewTimeScheduler = new ArrayList<String>();
    Vector<String> columnNames;

    {
        columnNames = new Vector<String>();
        columnNames.add("PatientID");
        columnNames.add("EmployeeID");
        columnNames.add("Date");
        columnNames.add("Time");
        columnNames.add("TimeSlots");
        columnNames.add("ReasonForVisiting");


    }
    
    public ViewTimeSchedule() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        ViewTimeSchedule = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null}
            },
            new String [] {
                "PartientID", "EmployeeID", "Date", "Time", "TimeSlots", "ReasonForVisiting"
            }
        ));
        jScrollPane1.setViewportView(jTable1);

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 24));
        jLabel1.setText("View Time Scheduler");

        javax.swing.GroupLayout ViewTimeScheduleLayout = new javax.swing.GroupLayout(ViewTimeSchedule);
        ViewTimeSchedule.setLayout(ViewTimeScheduleLayout);
        ViewTimeScheduleLayout.setHorizontalGroup(
            ViewTimeScheduleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ViewTimeScheduleLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 559, Short.MAX_VALUE))
            .addGroup(ViewTimeScheduleLayout.createSequentialGroup()
                .addGap(157, 157, 157)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 231, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(181, Short.MAX_VALUE))
        );
        ViewTimeScheduleLayout.setVerticalGroup(
            ViewTimeScheduleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ViewTimeScheduleLayout.createSequentialGroup()
                .addGap(41, 41, 41)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(68, 68, 68)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(ViewTimeSchedule, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(ViewTimeSchedule, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new ViewTimeSchedule().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel ViewTimeSchedule;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable jTable1;
    // End of variables declaration//GEN-END:variables
// private void initData() {
//
//
//        try {
//            //load db
//            Connectionsql db = Connectionsql.newInstance();
//            String sql = "select * from appointment";
//            ResultSet rs = db.query(sql);
//            while (rs.next()) {
//                ViewTimeScheduler.add(rs.getInt("PatientID"));
//            db.closeConn();
//            //show table
//            Vector<Vector<String>> data = new Vector<Vector<String>>();
//            for (int i = 0; i < ViewTimeScheduler.size(); i++) {
//                Vector<String> v = new Vector<String>();
//                v.add(ViewTimeScheduler.get(i).getId() + "");
//                v.add(ViewTimeScheduler.get(i).getName());
//                v.add(DateUtils.showDate(ViewTimeScheduler.get(i).getStartDate()));
//                v.add(DateUtils.showDate(ViewTimeScheduler.get(i).getEndDate()));
//                v.add(ViewTimeScheduler.get(i).getDescription());
//                //
//                data.add(v);
//
//            }
//            tbholiday.setModel(new DefaultTableModel(data, columnNames));
//        } catch (Exception ex) {
//            ex.printStackTrace();
//        }
//
//    }

    
    }


